package com.yunwaikeji.gy_tool_library.mvvm.view.fragment

import android.os.Bundle
import android.view.View
import androidx.lifecycle.ViewModelProvider
import com.yunwaikeji.gy_tool_library.mvvm.viewmodel.GYViewModel
import com.yunwaikeji.gy_tool_library.utils.GYClassUtils

abstract class GYApiFragment<ViewModel : GYViewModel> : GYFragment() {
    open val mViewModel: ViewModel by lazy {
        ViewModelProvider(this).get(GYClassUtils.getGenericSuperclass(this,1))
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        mViewAdmin.addDataObserver(mViewModel)
        super.onViewCreated(view, savedInstanceState)
    }
}